/**
 * Copyright (2017, ) Institute of Software, Chinese Academy of Sciences
 */
package cn.abcsys.cloud.devops.runtime.incubates.models;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wuheng(wuheng@otcaix.iscas.ac.cn)
 * @date Jul 10, 2017
 *
 */
public class Ngx implements Cloneable {

	/**
	 * 被管理的Nginx
	 */
	protected final String nginxhost;

	protected final String username;

	protected final String password;

	/**
	 * 被管理的Nginx主机信息
	 * 
	 * @param nginxhost
	 * @param username
	 * @param password
	 */
	public Ngx(String nginxhost, String username, String password) {
		super();
		this.nginxhost = nginxhost;
		this.username = username;
		this.password = password;
	}

	protected List<App> apps = new ArrayList<App>();

	public String getNginxhost() {
		return nginxhost;
	}

	public String getUsername() {
		return username;
	}

	public String getPassword() {
		return password;
	}

	/**
	 * 获取关联的App列表
	 * 
	 * @return
	 */
	public List<App> getApps() {
		return apps;
	}

	public void addApp(App app) {
		if (app == null) {
			throw new RuntimeException("app is null.");
		}
		this.apps.add(app);
	}

	public Object clone() throws CloneNotSupportedException {
		Ngx nginx = (Ngx) super.clone();
		return nginx;
	}

}
